<ul class="breadcrumb">
	<li><?php echo tabbed_menu_item(__('Home'), '@backoffice', 'index') ?> <span class="divider">/</span></li>
	<li><?php echo tabbed_menu_item(__('Catalog'), '@backoffice_catalog', 'list') ?> <span class="divider">/</span></li>
	<li class="active">List</li>
</ul>

<div class="pull-left">
	<img src="/images/creative_edit.png" style="padding-bottom:2px;"> <a href="#" onclick="show_create_dialog()"><?php echo __('New Sub Catalog') ?></a>
</div>
<div class="pull-right" style="display:none" id="close_dialog">
	<a class="close" href="#" onclick="show_create_dialog()">&times;</a>
</div>
<div class="clearfix"></div>
<div id="create_catalog" style="display:none; padding-top:10px;">
    <?php include_partial('catalog_form', array('catalog_form' => $create_catalog_form))?>
</div>
<div id="show_form_error" style="display:none" class="alert alert-error">
</div>
<script type="text/javascript">
    function show_create_dialog() {
        if ($('#create_catalog').is(":visible")) {
            $('#create_catalog').hide();
			$('#close_dialog').hide();
        } else {
            $('#create_catalog').show();
			$('#close_dialog').show();
		}
    }
    
    function sendAndPost() {
        $.post(
            "<?php echo url_for('@back_office_create_new_or_edit_catalog?catalog_id='.isset($catalog_id) ?:$catalog_id) ?>",
            $('#catalog_form').serialize(),
            function (data) {
                /*if (data.status == 'success') {
                    var success_dialog = new fss.Dialog({
                        context: '#create_catalog_form',
                        title: <?php echo json_encode(__('Success')) ?>,
                        message: <?php echo json_encode(__('You have created a new catalog.')) ?>,
                        cancel: <?php echo json_encode(__('Close')) ?>
                    });
                } else {
                    var fail_dialog = new fss.Dialog({
                        context: '#create_catalog_form',
                        title: <?php echo json_encode(__('Error')) ?>,
                        message: <?php echo json_encode(__('An error has occurred while creating a new catalog.')) ?>,
                        cancel: <?php echo json_encode(__('Close')) ?>
                    });
                    
                }*/
                $('#create_catalog').html(data);
            }, 'text');
		return false;
     }
</script>